how_tofandomcom-20200214-history
Guide to linux configuration files
This guide will show where various linux configuration files are located, shows howto configure them. =Users and Groups= Users: /etc/passwd /etc/passwd is the user authentication database, it contains a list of users and their associated internal user id numbers. Historically it also included passwords, however as this file needs to world readable (so all programs can use it to convert between username and user id) it is no longer considered secure to keep passwords in this file. An entry in this file is of the form: alice:*:134:20:Alice Monkey:/home/alice/:/bin/bash It has seven sections which going from left to right are, *''(alice)'' The username. *''(*)'' The password in a hashed form. In modern systems a star indicates shadowing is in use and hence the password can be found in /etc/shadow/. *''(134)'' The unique id assigned to the user. Some unique ids have special purposes. For example the user id 0 is used for the root user. *''(20)'' The group that the user is assigned to upon login. *''(Alice Monkey)'' The GCOS field, can be used for anything or left blank. Normally used for personal information abou the user such as full name. *''(/home/alice/)'' The home directory of the user. *''(/bin/bash)'' The users default shell. Groups: /etc/group /etc/group stores the definitive list of the users groups and their members. A typical entry is: root::0:root,alice It has four sections which going from left to right are, *''(root)'' The group name. *''()'' The group password in a hashed form. Normally not used. *''(0)'' The unique id assigned to the group. Group ids below 10 are reserved for system use. Some unixs such as HP-UX reserve other groups numbers as well. *''(root,alice)'' The list of users who are members of that group. Passwords: /etc/shadow /etc/shadow contains the passwords for users in systems which use shadowing. alice:43SrweDe3F:621:5:30:10:100:900: The sections are: *''(alice)'' The username. *''(43SrweDe3F)'' The password in hashed form. *''(621)'' date of last password change. *''(5)'' the mimimum number of days before the password may be changed. *''(30)'' the maximum number of days before the user is forced to change their password. *''(10)'' the number of days after which a user is advised to change their password. *''(100)'' the maximum number of days an account can be inactive for before it is suspeneded. *''(900)'' the date the account will expire, if left blank the account will remain indefinitely. Most often used for the purpose of temporary accounts. Individual Users Config Files (~/.xxxx) {{TODO|todonote=Move files for X11 from here to Guide to X11. The source of this information is Transwiki:Useful unix command, not this book. There is some redundancy across these programs. For example, the look and behavior of emacs can be customized by usinng the .emacs file, but also by adding the appropriate modifications to the .Xdefaults file. Default versions of these files are often installed in users' home directories when the software packages that use them are installed. If a program doesn't find its configuration file in the user's home directory, it will often fall back on a sytem-wide default configuration file installed in one of the subdirectories that the package lives in. * .bash_logout - file executed by bash shell on logout * .bash_profile - initialization of bash shell run only on login. Bash looks first for a .bash_profile file when started as a login shell or with the -login option. If it does not find .bash_profile, it looks for .bash_login. If it doesn't find that, it looks for .profile. System-wide functions and aliases go in /etc/bashrc and default environment variables go in /etc/profile. * .bashrc - initialization command run when bash shell starts up as a non-login shell * .cshrc - initialization commands that are run automatically (like autoexec.bat) when C shell is initiated * .emacs - configuration file for emacs editor * .fvwmrc - configuration file for fvwm window manager * .fvwm2rc - configuration file for fvwm2 window manager * .jedrc - configuration file for the jed text editor * .lessrc - typically contains key bindings for cursor movement with the less command * .login - initialization file when user logs in * .logout - commands run when user logs out * .wm_style - gives choice of default window manager if one is not specified in startx * .Xdefaults - sets up X resources for individual user. The behavior of many different application programs can be changed by modifying this file. * .xinitrc - initialization file when running startx. Can be used to activate applications, run a given window manager, and modify the appearance of the root window. * .xsession - configuration file for xdm /etc/sysctl.conf /etc/sysctl.conf configures the behavior of the running Unix kernel. During system boot, the scripts read this file and use "sysctl" to set the parameters shown in the file. Changing the file has no effect before the next reboot. Files to be merged in to the list * /etc/aliases - file containing aliases used by sendmail and other MTAs (mail transport agents). After updating this file, it is necessary to run the newaliases utility for the changes to be passed to sendmail. * /etc/bashrc - system-wide default functions and aliases for the bash shell * /etc/conf.modules - aliases and options for configurable modules * /etc/crontab - shell script to run different commands periodically (hourly, daily, weekly, monthly, etc.) * /etc/DIR_COLORS - used to store colors for different file types when using ls command. The dircolors command uses this file when there is not a .dir_colors file in the user's home directory. Used in conjunction with the eval command (see below). * /etc/exports - specifies hosts to which file systems can be exported using NFS. Man exports contains information on how to set up this file for remote users. * /etc/fstab - contains information on partitions and filesystems used by system to mount different partitions and devices on the directory tree * /etc/HOSTNAME - stores the name of the host computer * /etc/hosts - contains a list of host names and absolute IP addresses. * /etc/hosts.allow - hosts allowed (by the tcpd daemon) to access Internet services * /etc/hosts.deny - hosts forbidden (by the tcpd daemon) to access Internet services * /etc/group - similar to /etc/passwd but for groups * /etc/inetd.conf - configures the inetd daemon to tell it what TCP/IP services to provide (which daemons to load at boot time). A good start to securing a Linux box is to turn off these services unless they are necessary. * /etc/inittab - runs different programs and processes on startup. This is typically the program which is responsible for, among other things, setting the default runlevel, running the rc.sysinit script contained in /etc/rc.d, setting up virtual login terminals, bringing down the system in an orderly fashion in response to CtrlAltDel, running the rc script in /etc/rc.d, and running xdm for a graphical login prompt (only if the default runlevel is set for a graphical login). * /etc/issue - pre-login message. This is often overwitten by the /etc/rc.d/rc.S script (in Slackware) or by the /etc/rc.d/rc.local script (in Mandrake and Red Hat, and perhaps other rpm-based distributions). The relevant lines should be commented out (or changed) in these scripts if a custom pre-login message is desired. * /etc/lilo.conf - configuration file for lilo boot loader * /etc/motd - message of the day file, printed immediately after login. This is often overwritten by /etc/rc.d/rc.S (Slackware) or /etc/rc.d/rc.local (Mandrake/Red Hat) on startup. See the remarks in connection with /etc/issue. * /etc/mtab - shows currently mounted devices and partitions and their status * /etc/passwd - contains passwords and other information concerning users who are registered to use the system. For obvious security reasons, this is readable only by root. It can be modified by root directly, but it is preferable to use a configuration utility such as passwd to make the changes. A corrupt /etc/passwd file can easily render a Linux box unusable. * /etc/printcap - shows the setup of printers * /etc/profile - sets system-wide defaults for bash shell. It is this file in Slackware that sets up the DIR_COLORS environment variable for the color ls command. Also sets up other system-wide environment variables. * /etc/resolv.conf - contains a list of domain name servers used by the local machine * /etc/securetty - contains a list of terminals on which root can login. For security reasons, this should not include dialup terminals. * /etc/termcap - ASCII database defining the capabilities and characteristics of different consoles, terminals, and printers * /etc/X11/XF86Config - X configuration file. The location in Slackware is /etc/XF86Config. /var/ * /var/log/messages - used by syslog daemon to store kernel boot-time messages * /var/log/lastlog - used by system to store information about last boot * /var/log/wtmp - contains binary data indicating login times and duration for each user on system Boot Up Settings * Boot file sequence in the order they are accessed or executed *# /boot/grub.conf *# linux kernel *# /etc/inittab *# /etc/rc.sysinit *## init scripts *# login *# shell scripts *## /etc/profile *## /etc/bashrc *## ~/bash_profile *## ~/bashrc *##: for bash shell *# Starting X Windows *## /etc/X11/XF86Config for XFree86, /etc/X11/xorg.conf for X.Org *## many different scripts depending on install *## ~/.xinitrc *## ~/.Xdefaults *# scripts related to window manager See: Guide to linux boot sequence /boot/ * /boot/vmlinuz - the typical location and name of the Linux kernel. In the Slackware distribution, the kernel is located at /vmlinuz. /etc/profile /etc/profile contains the system default settings for users who login using the Bourne shell, "/bin/sh". When these users login, the Bourne shell runs the commands in this file before giving the shell prompt to the user. Most of these commands are variable assignments which configure the behavior of the shell. Some Bourne-compatible shells also use this file, but other shells, such as the C shell, do not. Libraries * Library Path **/etc/ld.so.conf * Execute '/sbin/ldconfig' to refresh the the library cache Environment Variables * Generally environment variables are set in the shell start up scripts *Guide to environment variables *Howto set environment variables X Server Setting # Starting X Windows ## /etc/X11/XF86Config for XFree86, /etc/X11/xorg.conf for X.Org ## many different scripts depending on install ## ~/.xinitrc ## ~/.Xdefaults # scripts related to window manager * Howto configure XF86config Video Players * Global config ** /etc/mplayer.conf * User Config ** ~/.mplayer/config * Binary Codecs Folder: /usr/local/lib/codec/ * Microsoft Win32 Codec: /usr/local/lib/win32/ *Howto configure mplayer =Networking= * /etc/hosts * /etc/host.conf * /etc/resolv.conf Howto setup a network in linux Samba * Samba server config file ** /etc/samba/smb.conf *Howto setup a samba server *Howto connect to a samba sever *Howto mount a networked samba folder =System= Setting System/Hardware Clock * Symbolic link to timezone ** /etc/localtime * UTC of local time zone *Howto Set the computers clock in unix *Howto set the computers timezone Hard Drive Mounts * Mount points ** /etc/fstab *Howto edit fstab Modules *modules.conf *modprobe.conf Fonts * Individual font directory files ** fonts.cache1 ** fonts.scale ** fonts.dir * Howto setup a font directory in unix Wine * User wine configuration file ** ~/.wine/config *Howto setup and configure wine ** /etc/bashrc ** /etc/profile ** /etc/bashrc ** /etc/bash/bashrc ** /etc/bash/bash_profile ** /etc/bash/bash_login ** /etc/bash/bash_logout *csh **profile.csh **csh.login **csh.envc **sh.cshrc =Distribution Specific= Redhat 8-9 *Login Manager, add window manager **/etc/X11/xdm/Xsession **/usr/share/apps/switchdesk/Xclients.wmaker **/etc/X11/gdm/Sessions/wmaker Gentoo */etc/portage/package.keywords */etc/portage/package.unmask */etc/portage/profile/package.provided */etc/make.profile/make.defaults */etc/make.profile/packages */etc/make.profile/parent */etc/profile.env */etc/env.d/* **/etc/env.d/10ldpath **/etc/env.d/05gcc **/etc/env.d/01hostname **/etc/env.d/00basic */etc/conf.d/* ** /etc/conf.d/local.stop **/etc/conf.d/local.start =Related guides= * Guide into free partitioning software for your hard drive * Guide into proprietary partitioning software for your hard drive =External links= * http://www.comptechdoc.org/os/linux/commands/linux_crspfiles.html * http://www.sabayonlinux.org/forum/viewtopic.php?f=54&t=10863